﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GN.Pay.TradeChannel.Configure
{
    /// <summary>
    /// Pfx 配置的通道
    /// </summary>
    [Serializable]
    public class ChannelPfxSignConfigureInfo : TradeChannelConfigureInfo
    {
        private byte[] _SignPfxRaw = null;

        /// <summary>
        /// 付款签名Pfx证书二进制
        /// </summary>
        /// <returns></returns>
        public byte[] SignPfxRaw()
        {
            if (_SignPfxRaw != null)
            {
                return _SignPfxRaw;
            }
            if (string.IsNullOrWhiteSpace(SignPfxRawBase64))
            {
                return null;
            }
            _SignPfxRaw = Convert.FromBase64String(SignPfxRawBase64);
            return _SignPfxRaw;
        }
        /// <summary>
        /// 付款签名Pfx证书64位二进制编码
        /// </summary>
        public string SignPfxRawBase64 { get; set; }

        /// <summary>
        /// 证书密码
        /// </summary>
        public string SignPfxPassWord { get; set; }

        private byte[] _SignVerifyCerRaw = null;

        /// <summary>
        /// 验签Cer证书二进制
        /// </summary>
        /// <returns></returns>
        public byte[] SignVerifyCerRaw()
        {
            if (_SignVerifyCerRaw != null)
            {
                return _SignVerifyCerRaw;
            }
            if (string.IsNullOrWhiteSpace(SignVerifyCerRawBase64))
            {
                return null;
            }
            _SignVerifyCerRaw = Convert.FromBase64String(SignVerifyCerRawBase64);
            return _SignVerifyCerRaw;
        }

        /// <summary>
        /// 付款验签公钥cer证书二进制
        /// </summary>
        public string SignVerifyCerRawBase64 { get; set; }
    }
}
